home *** CD-ROM | disk | FTP | other *** search
/ PC World 2007 December / PCWorld_2007-12_cd.bin / domacnost a kancelar / autoit / autoit-v3-setup.exe / Examples / Helpfile / _GUICtrlTreeViewSetState.au3 < prev    next >
Text File  |  2007-09-08  |  1KB  |  38 lines

  1. #include <GUIConstants.au3>
  2. #include <GuiTreeView.au3>
  3.  
  4. Opt("MustDeclareVars", 1)
  5.  
  6. Dim $h_GUI, $Msg, $treeview, $h_search, $s_file, $h_item
  7.  
  8. $h_GUI = GUICreate("TreeView UDF Sample", 220, 220)
  9.  
  10. $treeview = GUICtrlCreateTreeView(10, 10, 200, 200, -1, $WS_EX_CLIENTEDGE)
  11. GUICtrlSetImage(-1, "shell32.dll", 3, 4)
  12. GUICtrlSetImage(-1, "shell32.dll", 4, 2)
  13.  
  14. GUISetState()
  15.  
  16. $h_search = FileFindFirstFile("C:\*.*")
  17. If $h_search <> -1 Then
  18.     While 1
  19.         $s_file = FileFindNextFile($h_search)
  20.         If @error Then ExitLoop
  21.         If Not StringInStr(FileGetAttrib("C:\" & $s_file), "D") Then ContinueLoop
  22.         $h_item = _GUICtrlTreeViewInsertItem($treeview, $s_file)
  23.         _GUICtrlTreeViewSetState($treeview, $h_item, $TVIS_BOLD) ; bold all items
  24.         If StringInStr(FileGetAttrib("C:\" & $s_file), "H") Then _
  25.             _GUICtrlTreeViewSetState($treeview, $h_item, $TVIS_CUT, $TVIS_BOLD) ; set to appear as hidden, remove bold state
  26.     WEnd
  27. EndIf
  28.  
  29. While 1
  30.     $Msg = GUIGetMsg()
  31.     Switch $Msg
  32.         Case $GUI_EVENT_CLOSE
  33.             ExitLoop
  34.     EndSwitch
  35. WEnd
  36.  
  37. Exit
  38.